package com.zlhj.ex.config;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author zsx
 * @date 2021/06/17 10:36
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        String date = DateUtil.format(new Date(), "yyyyMMdd");
        this.setFieldValByName("create_time",date,metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
